/**
 * Copyright &copy; 2012-2016 <a href="https://istep.lczyfz.com">Istep</a> All rights reserved.
 */
package com.lczyfz.istep.modules.resource.service;

import com.lczyfz.istep.common.persistence.Page;
import com.lczyfz.istep.common.service.CrudService;
import com.lczyfz.istep.modules.resource.dao.ResourceQuestionOptionDao;
import com.lczyfz.istep.modules.resource.entity.ResourceQuestion;
import com.lczyfz.istep.modules.resource.entity.ResourceQuestionOption;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 考题选项表Service
 * @author dh
 * @version 2017-02-21
 */



@Service
@Transactional(readOnly = true)
public class ResourceQuestionOptionService extends CrudService<ResourceQuestionOptionDao, ResourceQuestionOption> {


	@Autowired
	ResourceQuestionOptionDao resourceQuestionOptionDao;

	public ResourceQuestionOption getByQuestionId(ResourceQuestionOption resourceQuestionOption)
	{
		return resourceQuestionOptionDao.getByQuestionId(resourceQuestionOption);
	}

	public ResourceQuestionOption get(String id) {

		return super.get(id);
	}
	
	public List<ResourceQuestionOption> findList(ResourceQuestionOption resourceQuestionOption) {
		return super.findList(resourceQuestionOption);
	}


	public Page<ResourceQuestionOption> findPage(Page<ResourceQuestionOption> page, ResourceQuestionOption resourceQuestionOption) {
		return super.findPage(page, resourceQuestionOption);
	}



	@Transactional(readOnly = false)
	public void save(ResourceQuestion resourceQuestion,String optionA,String optionB,String optionC,String optionD) {

		ResourceQuestionOption resourceQuestionOption1 = new ResourceQuestionOption();
		resourceQuestionOption1.setOptionA(optionA);
		resourceQuestionOption1.setOptionB(optionB);
		resourceQuestionOption1.setOptionC(optionC);
		resourceQuestionOption1.setOptionD(optionD);
		resourceQuestionOption1.setQuestionId(resourceQuestion.getId());
		super.save(resourceQuestionOption1);

	}
	@Transactional(readOnly = false)
	public void delete(ResourceQuestionOption resourceQuestionOption) {
		super.delete(resourceQuestionOption);
	}
	
}